
<%@ page import="auctionatr.Auction"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<g:set var="entityName"
	value="${message(code: 'auction.label', default: 'Auction')}" />
<title><g:message code="auction.auktionsliste.label" args="[entityName]" />
</title>
</head>
<body>
	<div class="body">
		<h1>
			<g:message code="auction.auktionsliste.label" args="[entityName]" />
		</h1>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
		<g:form action="search">
        ${message(code: 'auction.auktionsliste.search', default:'Search')}: 
        <input type="text" name="q" value="${params.q}" />
        <input type="submit" value="${message(code:'auction.auktionsliste.search', default:'Search') }" />
</g:form>
		<div class="list">
			<table>
				<thead>
					<tr>

						<g:sortableColumn property="name"
							title="${message(code: 'auction.name.label', default: 'Name')}" />

						<g:sortableColumn property="description"
							title="${message(code: 'auction.description.label', default: 'Description')}" />

						<g:sortableColumn property="finishDate"
							title="${message(code: 'auction.finishDate.label', default: 'Finish Date')}" />
						<g:if test="${params?.q == null}">
						<g:sortableColumn property="category"
							title="${message(code: 'auction.category.label', default: 'Category')}" />
						</g:if>
					</tr>
				</thead>
				<tbody>
					<g:each in="${auctionInstanceList}" status="i"
						var="auctionInstance">
						<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

							<td><g:link action="show" id="${auctionInstance.id}">
									${fieldValue(bean: auctionInstance, field: "name")}
								</g:link>
							</td>

							<td>
								${fieldValue(bean: auctionInstance, field: "description")}
							</td>

							<td><g:formatDate format="${message(code: 'default.date.format', default: 'DateFormat')}" date="${auctionInstance.finishDate}" />
							</td>

<g:if test="${params?.q == null}">
							<td>
							<g:link controller="auction" action="showCategory" id="${auctionInstance.categories.id}">
									${fieldValue(bean: auctionInstance.categories, field: "name")}
								</g:link>
							</td>
                        </g:if>
                        
						</tr>
					</g:each>
				</tbody>
			</table>
		</div>
		<div class="paginateButtons">
			<g:paginate total="${auctionInstanceTotal}" />
		</div>
	</div>
</body>
</html>
